package demo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class Test {
    public static void main(String[] args) {
        String a = "abcd12345ed125ss123058789";
        char[] chars = a.toCharArray();
        int max = 0;
        int end = -1;
        List<Integer> list = new ArrayList<>();
        Map<Integer,String> map = new TreeMap<Integer,String>();
        for(int i=0;i< chars.length;i++){
            if(chars[i]>='0' && chars[i]<='9'){

            } else {
                int key =  i - end;
                if(key <=1){
                    end = i;
                    continue;
                }
                String str = map.get(key);
                if(str!= null){
                    map.put(key,str+a.substring(end+1,i));
                } else{
                    map.put(key,a.substring(end,i)+"");
                }
                end = i;
            }
        }
        for(Integer str: map.keySet()){
            System.out.println(map.get(str)+","+str);
            break;
        }
    }
}
